
/**重置message，防止重复点击重复弹出message弹框 */
import {
    Notification
} from 'element-ui';
let messageInstance = null;
const resetMessage = (options) => {
    if(messageInstance) {
        messageInstance.close()
    }
    messageInstance = Notification(options)
}
['error','success','info','warning'].forEach(type => {
    resetMessage[type] = options => {
        if(typeof options === 'string') {
            options = {
                Notification:options
            }
        }
        options.type = type
        return resetMessage(options)
    }
})
const notify = resetMessage
export default notify